load("@devinfra//bazel/jasmine:jasmine.bzl", "jasmine_test")
load("//tools:defaults.bzl", "ts_config", "ts_project")

ts_config(
    name = "tsconfig",
    src = "tsconfig.json",
    visibility = ["//vscode-ng-language-service/syntaxes:__subpackages__"],
    deps = ["//vscode-ng-language-service:tsconfig_build"],
)

ts_project(
    name = "tests",
    testonly = True,
    srcs = glob(["*.ts"]),
    resolve_json_module = True,
    tsconfig = ":tsconfig",
    deps = [
        "//vscode-ng-language-service:node_modules/@types/jasmine",
        "//vscode-ng-language-service:node_modules/@types/node",
    ],
)

filegroup(
    name = "dummy",
    srcs = glob(["dummy/**"]),
)

filegroup(
    name = "data",
    srcs = glob(["data/**"]),
)

jasmine_test(
    name = "test",
    args = ["syntaxes/test/driver.js"],
    chdir = "vscode-ng-language-service",
    data = [
        ":data",
        ":dummy",
        ":tests",
        "//vscode-ng-language-service:node_modules/vscode-tmgrammar-test",
        "//vscode-ng-language-service:package_json",
        "//vscode-ng-language-service/syntaxes:json",
    ],
    node_modules = "//vscode-ng-language-service:node_modules",
    tags = ["unit_test"],
)
